-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Print a message on server timeout #6209
Conversation
When a remote server does not respond at all, a SocketTimeoutException is thrown which is mistakenly interpreted as an InterruptedIOException. Thus not printing an error message. This commit fixes it. see: bazelbuild#3851
url = "http://127.0.0.1:$fileserver_port/some_archive.zip", | ||
) | ||
EOF | ||
bazel build @repo//... &> $TEST_log 2>&1 && fail "Expected to fail" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How long does it wait for a timeout? I'm wondering how bad the effect on our CI is going to be...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test takes ~3 mins.
I did time bazel build @repo//... &> $TEST_log 2>&1 && fail "Expected to fail"
in line 938 and got:
** test_server_timeout *********************************************************
real 2m56.609s
user 0m0.020s
sys 0m0.016s
PASSED: test_server_timeout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's a problem. Having a test wait for 3 minutes doing nothing means our CI will take 3 minutes longer. Is there any way to change the timeout with a flag or something like that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way to change the timeout with a flag or something like that?
Not at the moment. All the timeouts are hard-coded. But adding a flag to configure those timeouts seems a good idea in general; will work on this.
This is related to: #3851
When Bazel tries to download a file from a repository, but the Server does not respond then Bazel does not print an informative message, as it does for other network failures.
More specifically, a SocketTimeoutException is thrown from HttpConnector (https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/HttpConnector.java)
The reason that no message is print is that exception caught is an InterruptedIOException (https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/bazel/repository/downloader/HttpDownloader.java#L229),
that is a super-class of SocketTimeoutException.
Fixing that by catching a SocketTimeoutException first.